{(******************************************************************************
**
**  TFloatList v2.0
**
**  Modified Version of TIntList by Daniel Schuhmann & Andreas Karg
**
**  Idea and Original Cody by Eric Lawrence & Mark Bracey (see below)
**
**
**
**
**           FEEDBACK IS GREATLY APPRECIATED, AS IT INSPIRES ME TO
**                    CONTINUE RELEASING FREE SOFTWARE
** Feedback to:
**
**                               Eric  Lawrence
**                           Applications Architect
**	                              Bayden Systems
**
**	 Send registration email to bayden@bigfoot.com
**        Check for updates at   www.bayden.com
**
**  To use:
**  Simply add TIntList to your the top of your unit in the 'uses' clause.
**  Then you can create and use TFloatLists just like you create and use
**  TStringLists!
**
**                        Idea and Original code by:
**                                Mark Bracey
**
**  This code may be used, modified, included in applications without any
**  license agreements as long as the disclaimers are accepted.  Credit should
**  be given where it is due.
**
**  Disclaimer:
**  This software is released into the public domain on the strict understanding
**  that neither myself nor any associates nor companies I work for have any
**  liability, explicit or implied.
**
**  Possible Enhancements:
**	                        Beats me.  Any ideas?
*******************************************************************************)}

unit FloatList;

interface

uses classes;

Type
   TFloatList = class(TList)

private
  procedure SetFloat(Index: Integer; Value: Single);
  function GetFloat(Index: Integer): Single;
public
  property Items [index: Integer]: Single read GetFloat write SetFloat; default;
  procedure Add(Value: Single);
  function IndexOf(Value: Single): Integer;
  procedure Sort;
end;

function SortHelper(Item1, Item2: Pointer): Integer;

implementation

function SortHelper(Item1, Item2: Pointer): Integer;
begin
  if (Single(Item1)<Single(Item2)) then result:=-1
    else
      if (Single(Item1)>Single(Item2)) then result:=1
        else
          result:=0;
end;

procedure TFloatList.Sort;
begin
  inherited Sort(SortHelper);
end;

function TFloatList.IndexOf(Value: Single): Integer;
begin
  result := inherited IndexOf(Pointer(Value));
end;

procedure TFloatList.SetFloat(Index: Integer; Value: Single);
begin
  inherited Items[Index]:= Pointer(Value);
end;

function TFloatList.GetFloat(Index: Integer): Single;
begin
  Result := Single(inherited Items[Index]);
end;

procedure TFloatList.Add(Value: Single);
begin
  inherited Add(Pointer(Value));
end;

end.
